package com.wh.cli.command;


import cn.hutool.core.bean.BeanUtil;
import com.wh.generator.MainGenerator;
import com.wh.model.MainTemplateConfig;
import lombok.Data;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

import java.util.concurrent.Callable;

@Command(name = "generate", mixinStandardHelpOptions = true, version = "generate 1.0",
description = "Generate a new project")
@Data
public class GenerateCommand implements Callable<Integer> {

    @Option(names={"-l","--loop"},description = "是否循环",interactive = true,echo = true,arity = "0..1")
    private boolean loop;

    @Option(names={"-a","--author"},description = "作者",interactive = true,echo = true,arity = "0..1")
    private String author = "wh";

    @Option(names={"-o","--outputText"},description = "输出文本",interactive = true,echo = true,arity = "0..1")
    private String outputText = "sum=";

    @Override
    public Integer call() throws Exception {
        MainTemplateConfig model = new MainTemplateConfig();
        BeanUtil.copyProperties(this,model);
        MainGenerator.doGenerate(model);
        return 0;
    }
}
